﻿using System;
using System.Windows.Forms;

namespace WolfGame {

  /// <summary>
  /// This class is the entry point to the program and creates all other objects.
  /// When an object is created, it is responsible for loading its own resources.
  /// </summary>
  public class MainClass {

    #region Member Variables

    private Common common;

    #endregion

    #region Program Initialization

    /// <summary>
    /// Initialize the class and create all needed objects.
    /// </summary>
    /// <param name="args">Command line arguments</param>
    public MainClass(String[] args) {
      common = new Common();
      common.Configuration = new m_Config(common, args);

      using (common.Render = new v_Renderer(common)) {
        common.Camera = new v_Camera(common);
        common.Keyboard = new c_Keyboard(common);
        common.Textures = new v_Textures(common);
        common.Map = new m_MapLoader(common);
        common.GameEvents = new m_GameEvents(common);
        common.Collider = new p_Collisions(common);
        Application.Run(common.Render);
      }

    }

    #endregion

    #region Entry Point

    /// <summary>
    /// Main entry point into the program.
    /// </summary>
    /// <param name="args"></param>
    public static void Main(String[] args) {
      new MainClass(args);
    }

    #endregion
  }

}
